<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>createdata.m</title>
<link rel="stylesheet" type="text/css" href="../../m-syntax.css">
</head>
<body>
<code>
<span class=defun_kw>function</span>&nbsp;<span class=defun_out>result&nbsp;</span>=&nbsp;<span class=defun_name>createdata</span>(<span class=defun_in>action,varargin</span>)<br>
<span class=h1>%&nbsp;CREATEDATA&nbsp;Interactive&nbsp;data&nbsp;generator.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>%&nbsp;&nbsp;createdata</span><br>
<span class=help>%&nbsp;&nbsp;createdata('finite')</span><br>
<span class=help>%&nbsp;&nbsp;createdata('finite',num_classes)</span><br>
<span class=help>%&nbsp;&nbsp;createdata('gauss')</span><br>
<span class=help>%&nbsp;&nbsp;createdata('gauss',num_distrib)</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>%&nbsp;&nbsp;createdata&nbsp;or&nbsp;createdata('finite')&nbsp;invokes&nbsp;an&nbsp;interactive&nbsp;generator&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;of&nbsp;finite&nbsp;point&nbsp;sets&nbsp;in&nbsp;2D.&nbsp;The&nbsp;generated&nbsp;points&nbsp;can&nbsp;be&nbsp;assigned&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;into&nbsp;two&nbsp;classes&nbsp;(1,2).&nbsp;The&nbsp;generator&nbsp;saves&nbsp;data&nbsp;to&nbsp;a&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;specified&nbsp;file.&nbsp;The&nbsp;file&nbsp;has&nbsp;the&nbsp;following&nbsp;fields:</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;X&nbsp;[2&nbsp;x&nbsp;num_data]&nbsp;2D&nbsp;vectors.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;y&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Assigned&nbsp;labels.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;&nbsp;createdata('finite',num_classes)&nbsp;when&nbsp;num_classes&nbsp;is&nbsp;specified</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;then&nbsp;the&nbsp;points&nbsp;can&nbsp;be&nbsp;assigned&nbsp;labels&nbsp;from&nbsp;1&nbsp;to&nbsp;num_classes.</span><br>
<span class=help>%&nbsp;&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;createdata('gauss')&nbsp;invokes&nbsp;an&nbsp;interactive&nbsp;generator&nbsp;of&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;Gaussian&nbsp;distributions.&nbsp;A&nbsp;user&nbsp;can&nbsp;specify&nbsp;mean&nbsp;vector&nbsp;and</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;covariance&nbsp;matrix.&nbsp;The&nbsp;generator&nbsp;saves&nbsp;data&nbsp;to&nbsp;a&nbsp;file</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;having&nbsp;the&nbsp;following&nbsp;fields:</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;&nbsp;Mean&nbsp;[2&nbsp;x&nbsp;ncomp]&nbsp;Mean&nbsp;vectors.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;&nbsp;Cov&nbsp;[2&nbsp;x&nbsp;2&nbsp;x&nbsp;ncomp]&nbsp;Covariance&nbsp;matrices.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;&nbsp;y&nbsp;[1&nbsp;x&nbsp;ncomp]&nbsp;Assigned&nbsp;labels.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;&nbsp;createdata('gauss',num_classes)&nbsp;when&nbsp;num_classes&nbsp;is&nbsp;specified</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;then&nbsp;the&nbsp;distributions&nbsp;can&nbsp;be&nbsp;assigned&nbsp;labels&nbsp;from&nbsp;1&nbsp;to&nbsp;num_classes.</span><br>
<span class=help>%&nbsp;&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;The&nbsp;data&nbsp;generator&nbsp;is&nbsp;controlled&nbsp;by&nbsp;mouse:</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;&nbsp;Left&nbsp;button&nbsp;&nbsp;...&nbsp;creates&nbsp;a&nbsp;new&nbsp;point&nbsp;or&nbsp;Gaussian.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;&nbsp;Right&nbsp;button&nbsp;...&nbsp;erases&nbsp;the&nbsp;focused&nbsp;point&nbsp;or&nbsp;Gaussian.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;&nbsp;In&nbsp;the&nbsp;case&nbsp;of&nbsp;generating&nbsp;Gaussians&nbsp;left&nbsp;button&nbsp;double-click&nbsp;makes</span><br>
<span class=help>%&nbsp;&nbsp;selected&nbsp;Gaussian&nbsp;focused.&nbsp;The&nbsp;covariance&nbsp;matrix&nbsp;of&nbsp;focused&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;Gaussian&nbsp;can&nbsp;be&nbsp;modified.</span><br>
<span class=help>%</span><br>
<hr>
<br>
<span class=help1>%&nbsp;<span class=help1_field>About:</span>&nbsp;Statistical&nbsp;Pattern&nbsp;Recognition&nbsp;Toolbox</span><br>
<span class=help1>%&nbsp;(C)&nbsp;1999-2003,&nbsp;Written&nbsp;by&nbsp;Vojtech&nbsp;Franc&nbsp;and&nbsp;Vaclav&nbsp;Hlavac&nbsp;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://www.cvut.cz"&gt;Czech&nbsp;Technical&nbsp;University&nbsp;Prague&lt;/a&gt;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://www.feld.cvut.cz"&gt;Faculty&nbsp;of&nbsp;Electrical&nbsp;Engineering&lt;/a&gt;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://cmp.felk.cvut.cz"&gt;Center&nbsp;for&nbsp;Machine&nbsp;Perception&lt;/a&gt;</span><br>
<br>
<span class=help1>%&nbsp;<span class=help1_field>Modifications:</span>&nbsp;&nbsp;&nbsp;</span><br>
<span class=help1>%&nbsp;01-may-2004,&nbsp;VF</span><br>
<span class=help1>%&nbsp;13-Feb-2003,&nbsp;VF&nbsp;&nbsp;</span><br>
<br>
<br>
<hr>
XCOLORS=[<span class=quotes>'r'</span>,<span class=quotes>'b'</span>,<span class=quotes>'g'</span>,<span class=quotes>'m'</span>,<span class=quotes>'c'</span>,<span class=quotes>'k'</span>,<span class=quotes>'y'</span>];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;colors&nbsp;of&nbsp;the&nbsp;ellipses</span><br>
MAXCOLOR=size(XCOLORS,2);<br>
ID_NORMAL=<span class=quotes>'Infinite&nbsp;sets,&nbsp;Normal&nbsp;distributions'</span>;<br>
ID_FINITE=<span class=quotes>'Finite&nbsp;sets,&nbsp;Enumeration'</span>;<br>
DX_SPACE=0.5;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;space&nbsp;betwean&nbsp;the&nbsp;nearest&nbsp;point&nbsp;and&nbsp;the&nbsp;left&nbsp;and&nbsp;right&nbsp;border</span><br>
DY_SPACE=0.5;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;--//--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;top&nbsp;and&nbsp;bottom&nbsp;-//-</span><br>
<br>
<span class=keyword>if</span>&nbsp;<span class=stack>nargin</span>&nbsp;&lt;&nbsp;1,<br>
&nbsp;&nbsp;&nbsp;action&nbsp;=&nbsp;<span class=quotes>'finite'</span>;<br>
<span class=keyword>end</span><br>
<br>
<span class=keyword>switch</span>&nbsp;lower(action)<br>
<span class=label>case</span>&nbsp;<span class=quotes>'finite'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;We&nbsp;will&nbsp;create&nbsp;finite&nbsp;data&nbsp;sets&nbsp;===================================</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;<span class=stack>nargin</span>&nbsp;&lt;&nbsp;2,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=2;<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;createdata(<span class=quotes>'initialize'</span>,action,K,<span class=stack>varargin</span>{2:<span class=stack>nargin</span>-1});<br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'gauss'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;We&nbsp;will&nbsp;create&nbsp;gaussian&nbsp;distributed&nbsp;sets&nbsp;&nbsp;===========================</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;<span class=stack>nargin</span>&nbsp;&lt;&nbsp;2,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=2;<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;createdata(<span class=quotes>'initialize'</span>,action,K,<span class=stack>varargin</span>{2:<span class=stack>nargin</span>-1});<br>
<br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'initialize'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Initialize&nbsp;dialog&nbsp;window&nbsp;=========================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;input&nbsp;arguments</span><br>
&nbsp;&nbsp;&nbsp;K=<span class=stack>varargin</span>{2};<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Figure&nbsp;===========================================================</span><br>
&nbsp;&nbsp;&nbsp;hfigure&nbsp;=&nbsp;<span class=graph>figure</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Visible'</span>,<span class=quotes>'off'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'NumberTitle'</span>,<span class=quotes>'off'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'RendererMode'</span>,<span class=quotes>'manual'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Axes&nbsp;=============================================================</span><br>
&nbsp;&nbsp;&nbsp;haxes1=&nbsp;<span class=graph>axes</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ButtonDownFcn'</span>,<span class=quotes>'createdata('</span><span class=quotes>'click'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Box'</span>,<span class=quotes>'on'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'XGrid'</span>,<span class=quotes>'on'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'YGrid'</span>,<span class=quotes>'on'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'NextPlot'</span>,<span class=quotes>'add'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[0.1&nbsp;0.1&nbsp;0.65&nbsp;0.85]);<br>
&nbsp;&nbsp;&nbsp;<span class=graph>axis</span>([-1&nbsp;1&nbsp;-1&nbsp;1]);<br>
&nbsp;&nbsp;&nbsp;xlabel(<span class=quotes>'X'</span>);<br>
&nbsp;&nbsp;&nbsp;ylabel(<span class=quotes>'Y'</span>);<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Buttons&nbsp;==========================================================</span><br>
&nbsp;&nbsp;&nbsp;left=0.8;<br>
&nbsp;&nbsp;&nbsp;bottom=0.05;<br>
&nbsp;&nbsp;&nbsp;height=0.05;<br>
&nbsp;&nbsp;&nbsp;width=0.15;<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;close&nbsp;button</span><br>
&nbsp;&nbsp;&nbsp;hbtclose&nbsp;=&nbsp;<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Callback'</span>,<span class=quotes>'createdata('</span><span class=quotes>'close'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Close'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;ok&nbsp;button</span><br>
&nbsp;&nbsp;&nbsp;bottom=bottom+1*height;<br>
&nbsp;&nbsp;&nbsp;hbtok&nbsp;=&nbsp;<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Callback'</span>,<span class=quotes>'createdata('</span><span class=quotes>'ok'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'UserData'</span>,<span class=stack>varargin</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'OK'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;info&nbsp;button</span><br>
&nbsp;&nbsp;&nbsp;bottom=bottom+1.5*height;<br>
&nbsp;&nbsp;&nbsp;hbtinfo&nbsp;=&nbsp;<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Callback'</span>,<span class=quotes>'createdata('</span><span class=quotes>'info'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Info'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;load&nbsp;button</span><br>
&nbsp;&nbsp;&nbsp;bottom=bottom+1.5*height;<br>
&nbsp;&nbsp;&nbsp;hbtload&nbsp;=&nbsp;<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Callback'</span>,<span class=quotes>'createdata('</span><span class=quotes>'load'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Load'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;save&nbsp;button</span><br>
&nbsp;&nbsp;&nbsp;file=struct(<span class=quotes>'name'</span>,<span class=quotes>'noname.mat'</span>,<span class=quotes>'path'</span>,<span class=quotes>''</span>,<span class=quotes>'pathname'</span>,<span class=quotes>'noname.mat'</span>);<br>
&nbsp;&nbsp;&nbsp;bottom=bottom+1*height;<br>
&nbsp;&nbsp;&nbsp;hbtsave&nbsp;=&nbsp;<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'Normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Callback'</span>,<span class=quotes>'createdata('</span><span class=quotes>'save'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'UserData'</span>,file,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Save'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Popup&nbsp;menus&nbsp;===================================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;popup&nbsp;menu&nbsp;-&nbsp;class</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;title</span><br>
&nbsp;&nbsp;&nbsp;bottom=0.91;<br>
&nbsp;&nbsp;&nbsp;htxclass&nbsp;=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'text'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;0.9*height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Class'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;popup&nbsp;menu</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:K,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;txnum=<span class=io>sprintf</span>(<span class=quotes>'&nbsp;%d&nbsp;'</span>,i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classes(i,1:size(txnum,2))=txnum;<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;bottom=bottom-height;<br>
&nbsp;&nbsp;&nbsp;hpuclass=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'popup'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,classes);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Edit&nbsp;lines&nbsp;=======================================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;x-axis</span><br>
&nbsp;&nbsp;&nbsp;bottom=bottom-1.2*height;<br>
&nbsp;&nbsp;&nbsp;htxxaxis=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'text'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;0.9*height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'X-Axis'</span>);<br>
&nbsp;&nbsp;&nbsp;bottom=bottom-height;<br>
&nbsp;&nbsp;&nbsp;hedxaxis&nbsp;=&nbsp;<span class=graph>uicontrol</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'CallBack'</span>,<span class=quotes>'createdata('</span><span class=quotes>'setaxis'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'edit'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'[-1&nbsp;1]'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;y-axis</span><br>
&nbsp;&nbsp;&nbsp;bottom=bottom-1.2*height;<br>
&nbsp;&nbsp;&nbsp;htxyaxis=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'text'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;0.9*height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Y-Axis'</span>);<br>
&nbsp;&nbsp;&nbsp;bottom=bottom-height;<br>
&nbsp;&nbsp;&nbsp;hedyaxis&nbsp;=&nbsp;<span class=graph>uicontrol</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'CallBack'</span>,<span class=quotes>'createdata('</span><span class=quotes>'setaxis'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'edit'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'[-1&nbsp;1]'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;normal&nbsp;distributions&nbsp;are&nbsp;given&nbsp;by&nbsp;SIGMA&nbsp;in&nbsp;addition</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(<span class=stack>varargin</span>{1},<span class=quotes>'gauss'</span>),<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;label</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bottom=bottom-1.5*height;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htxcov=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'text'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;0.9*height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'Covariance'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;cov(xy)</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bottom=bottom-height;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hedxx&nbsp;=&nbsp;<span class=graph>uicontrol</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width*0.5&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'CallBack'</span>,<span class=quotes>'createdata('</span><span class=quotes>'setcov'</span><span class=quotes>',gcf,1)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'edit'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'1'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;cov(xy)</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hedxy&nbsp;=&nbsp;<span class=graph>uicontrol</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left+width*0.5&nbsp;bottom&nbsp;width*0.5&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'CallBack'</span>,<span class=quotes>'createdata('</span><span class=quotes>'setcov'</span><span class=quotes>',gcf,2)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'edit'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'0'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;cov(yx)</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bottom=bottom-height;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hedyx&nbsp;=&nbsp;<span class=graph>uicontrol</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width*0.5&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'CallBack'</span>,<span class=quotes>'createdata('</span><span class=quotes>'setcov'</span><span class=quotes>',gcf,3)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'edit'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'0'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;cov(yy)</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hedyy&nbsp;=&nbsp;<span class=graph>uicontrol</span>(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ListboxTop'</span>,0,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left+width*0.5&nbsp;bottom&nbsp;width*0.5&nbsp;height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'CallBack'</span>,<span class=quotes>'createdata('</span><span class=quotes>'setcov'</span><span class=quotes>',gcf,4)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'edit'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'1'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bottom=bottom-1.2*height;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htxmi1=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'text'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;0.9*height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'MI=['</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bottom=bottom-0.9*height;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;htxmi2=<span class=graph>uicontrol</span>(&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Style'</span>,<span class=quotes>'text'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[left&nbsp;bottom&nbsp;width&nbsp;0.9*height],&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'String'</span>,<span class=quotes>'&nbsp;&nbsp;&nbsp;&nbsp;]'</span>);<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Axes&nbsp;title&nbsp;========================================================</span><br>
&nbsp;&nbsp;&nbsp;pos=<span class=graph>get</span>(haxes1,<span class=quotes>'Position'</span>);<br>
&nbsp;&nbsp;&nbsp;titletext=<span class=io>sprintf</span>(<span class=quotes>'File:&nbsp;%s'</span>,file.name);<br>
&nbsp;&nbsp;&nbsp;fontsize=(1-pos(2)-pos(4))*0.8;<br>
&nbsp;&nbsp;&nbsp;htitle=title(titletext,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'VerticalAlignment'</span>,<span class=quotes>'bottom'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'HorizontalAlignment'</span>,<span class=quotes>'left'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'FontUnits'</span>,<span class=quotes>'normalized'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Units'</span>,<span class=quotes>'normalized'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Position'</span>,[0&nbsp;1&nbsp;0],...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'FontSize'</span>,fontsize);<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;=========================================================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;create&nbsp;the&nbsp;structures&nbsp;according&nbsp;to&nbsp;the&nbsp;current&nbsp;set&nbsp;type</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>switch</span>&nbsp;lower(<span class=stack>varargin</span>{1}),<br>
&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'finite'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'name'</span>,<span class=quotes>'Generator&nbsp;of&nbsp;finite&nbsp;point&nbsp;sets'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ident=ID_FINITE;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;handlers</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handlers=struct(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'settype'</span>,lower(<span class=stack>varargin</span>{1}),...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'saved'</span>,1,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'btsave'</span>,hbtsave,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edxaxis'</span>,hedxaxis,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edyaxis'</span>,hedyaxis,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'title'</span>,htitle,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'btok'</span>,hbtok,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'axes1'</span>,haxes1,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'puclass'</span>,hpuclass&nbsp;);<br>
&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'gauss'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'name'</span>,<span class=quotes>'Generator&nbsp;of&nbsp;Gaussian&nbsp;distributions'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ident=ID_NORMAL;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;handlers</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handlers=struct(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'settype'</span>,lower(<span class=stack>varargin</span>{1}),...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'currpoint'</span>,0,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'currhandle'</span>,0,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'saved'</span>,1,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'title'</span>,htitle,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'btsave'</span>,hbtsave,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edxaxis'</span>,hedxaxis,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edyaxis'</span>,hedyaxis,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'txmi1'</span>,htxmi1,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'txmi2'</span>,htxmi2,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edxx'</span>,hedxx,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edxy'</span>,hedxy,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edyx'</span>,hedyx,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'edyy'</span>,hedyy,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'btok'</span>,hbtok,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'axes1'</span>,haxes1,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'puclass'</span>,hpuclass&nbsp;);<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;sets=struct(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'K'</span>,zeros(1,K),...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'X'</span>,[],...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'I'</span>,[],...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'MI'</span>,[],...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'SIGMA'</span>,[],...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'N'</span>,2,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'id'</span>,ident);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;store&nbsp;handlers&nbsp;and&nbsp;data&nbsp;set&nbsp;structure</span><br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,handlers);<br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(haxes1,<span class=quotes>'UserData'</span>,sets);<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;figure&nbsp;as&nbsp;visible</span><br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'Visible'</span>,<span class=quotes>'on'</span>);<br>
<br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'setcov'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Set&nbsp;covariance&nbsp;matrix&nbsp;of&nbsp;current&nbsp;selected&nbsp;point&nbsp;===================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;handlers</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%get&nbsp;data&nbsp;set</span><br>
&nbsp;&nbsp;&nbsp;sets=<span class=graph>get</span>(h.axes1,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;current&nbsp;point</span><br>
&nbsp;&nbsp;&nbsp;i=h.currpoint;<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;<span class=stack>varargin</span>{2}==2,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edyx,<span class=quotes>'String'</span>,<span class=graph>get</span>(h.edxy,<span class=quotes>'String'</span>));<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>elseif</span>&nbsp;<span class=stack>varargin</span>{2}==3,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edxy,<span class=quotes>'String'</span>,<span class=graph>get</span>(h.edyx,<span class=quotes>'String'</span>));<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;if&nbsp;some&nbsp;point&nbsp;is&nbsp;selected</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;i&nbsp;~=&nbsp;0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;cov.&nbsp;matrix&nbsp;from&nbsp;edit&nbsp;lines</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma(1,1)=str2num(<span class=graph>get</span>(h.edxx,<span class=quotes>'String'</span>));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma(1,2)=str2num(<span class=graph>get</span>(h.edxy,<span class=quotes>'String'</span>));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma(2,1)=str2num(<span class=graph>get</span>(h.edyx,<span class=quotes>'String'</span>));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma(2,2)=str2num(<span class=graph>get</span>(h.edyy,<span class=quotes>'String'</span>));<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;is&nbsp;sigma&nbsp;positive&nbsp;definite&nbsp;?</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[aa,p]=chol(sigma);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;p&nbsp;~=&nbsp;0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edxx,<span class=quotes>'String'</span>,<span class=quotes>'1'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edxy,<span class=quotes>'String'</span>,<span class=quotes>'0'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edyx,<span class=quotes>'String'</span>,<span class=quotes>'0'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edyy,<span class=quotes>'String'</span>,<span class=quotes>'1'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma=eye(2,2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.SIGMA(:,(i-1)*2+1:i*2)=sigma;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.axes1,<span class=quotes>'UserData'</span>,sets);<br>
<br>
<span class=comment>%%%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window=axis;</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window=getaxis(h.axes1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R=min([(window(2)-window(1)),(window(4)-window(3))])/20;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i=h.currpoint;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;class=sets.I(i);<br>
<span class=comment>%%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isigma=inv(sigma);</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mi=sets.MI(:,i);<br>
<span class=comment>%%%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[x,y]=ellipse(isigma,20,R,mi);</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[x,y]=ellips(mi,inv(sigma),R);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;h.currhandle==0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;draw&nbsp;new&nbsp;ellipse</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currhandle&nbsp;=fill(x,y,XCOLORS(mod(class-1,MAXCOLOR)+1),...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'EraseMode'</span>,<span class=quotes>'none'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ButtonDownFcn'</span>,<span class=quotes>'createdata('</span><span class=quotes>'click'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Tag'</span>,<span class=quotes>'ellipse'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'UserData'</span>,mi);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.currhandle,<span class=quotes>'XData'</span>,x,<span class=quotes>'YData'</span>,y,<span class=quotes>'EraseMode'</span>,<span class=quotes>'normal'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;i&nbsp;~=&nbsp;0,</span><br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'redraw'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Redraw&nbsp;axes&nbsp;===========================================================</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h&nbsp;=&nbsp;<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;handlers</span><br>
<br>
&nbsp;&nbsp;&nbsp;children=<span class=graph>get</span>(h.axes1,<span class=quotes>'Children'</span>&nbsp;);<br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(children,<span class=quotes>'EraseMode'</span>,<span class=quotes>'normal'</span>,<span class=quotes>'Visible'</span>,<span class=quotes>'off'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;sets</span><br>
&nbsp;&nbsp;&nbsp;sets=<span class=graph>get</span>(h.axes1,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;axes</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(sets.id,ID_FINITE)==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxs=max(sets.X');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mins=min(sets.X');<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>elseif</span>&nbsp;strcmpi(sets.id,ID_NORMAL&nbsp;)==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;axes</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxs=max(sets.MI');<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mins=min(sets.MI');<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;dx=min(&nbsp;(maxs(1)-mins(1)),&nbsp;1&nbsp;)*DX_SPACE;<br>
&nbsp;&nbsp;&nbsp;dy=min(&nbsp;(maxs(2)-mins(2)),&nbsp;1&nbsp;)*DY_SPACE;<br>
&nbsp;&nbsp;&nbsp;x1=round(mins(1)-dx);<br>
&nbsp;&nbsp;&nbsp;x2=round(maxs(1)+dx);<br>
&nbsp;&nbsp;&nbsp;y1=round(mins(2)-dy);<br>
&nbsp;&nbsp;&nbsp;y2=round(maxs(2)+dx);<br>
&nbsp;&nbsp;&nbsp;win=[x1&nbsp;x2&nbsp;y1&nbsp;y2];<br>
&nbsp;&nbsp;&nbsp;<span class=graph>axes</span>(h.axes1);<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%%%&nbsp;&nbsp;&nbsp;axis(win);</span><br>
&nbsp;&nbsp;&nbsp;setaxis(h.axes1,win);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;redraw&nbsp;points&nbsp;or&nbsp;ellipses</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(sets.id,ID_FINITE)==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;points</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:sum(sets.K),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>line</span>(sets.X(1,i),sets.X(2,i),&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'LineStyle'</span>,<span class=quotes>'none'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Marker'</span>,<span class=quotes>'.'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Color'</span>,XCOLORS(mod(sets.I(i)-1,MAXCOLOR)+1),&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'MarkerSize'</span>,25,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ButtonDownFcn'</span>,<span class=quotes>'createdata('</span><span class=quotes>'click'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'EraseMode'</span>,<span class=quotes>'none'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Tag'</span>,<span class=quotes>'point'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>elseif</span>&nbsp;strcmpi(sets.id,ID_NORMAL&nbsp;)==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R=min([(win(2)-win(1)),(win(4)-win(3))])/20;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;ellipses</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:sum(sets.K),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma=sets.SIGMA(:,(i-1)*2+1:i*2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mi=sets.MI(:,i);<br>
<span class=comment>%%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[x,y]=ellipse(isigma,20,R,mi);</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[x,y]=ellips(mi,inv(sigma),R);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;class=sets.I(i);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fill(x,y,XCOLORS(mod(class-1,MAXCOLOR)+1),...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'EraseMode'</span>,<span class=quotes>'none'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ButtonDownFcn'</span>,<span class=quotes>'createdata('</span><span class=quotes>'click'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Tag'</span>,<span class=quotes>'ellipse'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'UserData'</span>,mi);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;strcmpi(...</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;new&nbsp;values</span><br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edxaxis,<span class=quotes>'String'</span>,<span class=io>sprintf</span>(<span class=quotes>'[%s]'</span>,num2str(win(1:2)))&nbsp;);<br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edyaxis,<span class=quotes>'String'</span>,<span class=io>sprintf</span>(<span class=quotes>'[%s]'</span>,num2str(win(3:4)))&nbsp;);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:max(size(sets.K)),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;txnum=<span class=io>sprintf</span>(<span class=quotes>'&nbsp;%d&nbsp;'</span>,i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;classes(i,1:size(txnum,2))=txnum;<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.puclass,<span class=quotes>'String'</span>,classes);<br>
<br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'setaxis'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Set&nbsp;axes&nbsp;according&nbsp;to&nbsp;edit&nbsp;line&nbsp;X-Axis&nbsp;and&nbsp;Y-Axis&nbsp;==================</span><br>
<br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h&nbsp;=&nbsp;<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;handlers</span><br>
<br>
&nbsp;&nbsp;&nbsp;xaxis=str2num(<span class=graph>get</span>(h.edxaxis,<span class=quotes>'String'</span>));<br>
&nbsp;&nbsp;&nbsp;yaxis=str2num(<span class=graph>get</span>(h.edyaxis,<span class=quotes>'String'</span>));<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;size(xaxis)&nbsp;~=&nbsp;[1&nbsp;2]&nbsp;|&nbsp;xaxis(2)&nbsp;&lt;=&nbsp;xaxis(1),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;errordlg(<span class=quotes>'Bad&nbsp;X-Axis&nbsp;limits.'</span>,<span class=quotes>'Error'</span>,<span class=quotes>'modal'</span>);<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>elseif</span>&nbsp;size(yaxis)&nbsp;~=&nbsp;[1&nbsp;2]&nbsp;|&nbsp;yaxis(2)&nbsp;&lt;=&nbsp;yaxis(1),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;errordlg(<span class=quotes>'Bad&nbsp;Y-Axis&nbsp;limits.'</span>,<span class=quotes>'Error'</span>,<span class=quotes>'modal'</span>);<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setaxis(h.axes1,[xaxis&nbsp;yaxis]);<br>
<span class=comment>%%%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;axis([xaxis&nbsp;yaxis]);</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
<br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'click'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Mouse&nbsp;click&nbsp;handler&nbsp;=================================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;handlers</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'Userdata'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;current&nbsp;pointer&nbsp;position</span><br>
&nbsp;&nbsp;&nbsp;pointer=<span class=graph>get</span>(h.axes1,<span class=quotes>'CurrentPoint'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;data&nbsp;sets&nbsp;structure</span><br>
&nbsp;&nbsp;&nbsp;sets=<span class=graph>get</span>(h.axes1,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;gco&nbsp;object&nbsp;invoked&nbsp;this&nbsp;function</span><br>
&nbsp;&nbsp;&nbsp;hobject=<span class=graph>gco</span>;<br>
<br>
&nbsp;&nbsp;&nbsp;clicktype&nbsp;=&nbsp;lower(<span class=graph>get</span>(hfigure,<span class=quotes>'SelectionType'</span>));<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>switch</span>&nbsp;clicktype<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'normal'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;===&nbsp;Left&nbsp;mouse&nbsp;button&nbsp;=============</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;Creat&nbsp;new&nbsp;point</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;~strcmpi(<span class=graph>get</span>(hobject,<span class=quotes>'Tag'</span>),<span class=quotes>'point'</span>)&nbsp;&&nbsp;~strcmpi(<span class=graph>get</span>(hobject,<span class=quotes>'Tag'</span>),<span class=quotes>'ellipse'</span>),<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;up&nbsp;saved&nbsp;flag</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.saved=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;class&nbsp;number</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;class=<span class=graph>get</span>(h.puclass,<span class=quotes>'Value'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;update&nbsp;data&nbsp;set</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.K(class)=sets.K(class)+1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.I(sum(sets.K))=class;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>switch</span>&nbsp;h.settype<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'finite'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.X=[sets.X,[pointer(1,1);pointer(1,2)]];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>line</span>(pointer(1,1),pointer(1,2),&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'LineStyle'</span>,<span class=quotes>'none'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Marker'</span>,<span class=quotes>'.'</span>,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Color'</span>,XCOLORS(mod(class-1,MAXCOLOR)+1),&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'MarkerSize'</span>,25,&nbsp;...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'ButtonDownFcn'</span>,<span class=quotes>'createdata('</span><span class=quotes>'click'</span><span class=quotes>',gcf)'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'EraseMode'</span>,<span class=quotes>'none'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Tag'</span>,<span class=quotes>'point'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;store&nbsp;data&nbsp;set</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.axes1,<span class=quotes>'UserData'</span>,sets);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'gauss'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.MI=[sets.MI,[pointer(1,1);pointer(1,2)]];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.SIGMA=[sets.SIGMA,eye(2,2)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.txmi1,<span class=quotes>'String'</span>,<span class=io>sprintf</span>(<span class=quotes>'MI=[%.2f'</span>,pointer(1,1)));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.txmi2,<span class=quotes>'String'</span>,<span class=io>sprintf</span>(<span class=quotes>'&nbsp;&nbsp;&nbsp;&nbsp;%.2f]'</span>,pointer(1,2)));<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;cov&nbsp;matrix&nbsp;and&nbsp;draw&nbsp;ellipse</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currpoint=size(sets.MI,2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currhandle=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.axes1,<span class=quotes>'UserData'</span>,sets);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;createdata(<span class=quotes>'setcov'</span>,hfigure,0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;~strcmpi(</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'open'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Double&nbsp;click&nbsp;===</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;info&nbsp;about&nbsp;selected&nbsp;point</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(h.settype,<span class=quotes>'gauss'</span>)==1&nbsp;&&nbsp;strcmpi(<span class=graph>get</span>(hobject,<span class=quotes>'Tag'</span>),<span class=quotes>'ellipse'</span>),<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;selected&nbsp;point&nbsp;as&nbsp;currpoint</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pixelpos=<span class=graph>get</span>(hobject,<span class=quotes>'UserData'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=sum(sets.K);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:K,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;pixelpos==sets.MI(:,i),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currpoint=i;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currhandle=hobject;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sigma=sets.SIGMA(:,(i-1)*2+1:i*2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mi=sets.MI(:,i);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;mi</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.txmi1,<span class=quotes>'String'</span>,<span class=io>sprintf</span>(<span class=quotes>'MI=[%.2f'</span>,mi(1)));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.txmi2,<span class=quotes>'String'</span>,<span class=io>sprintf</span>(<span class=quotes>'&nbsp;&nbsp;&nbsp;&nbsp;%.2f]'</span>,mi(2)));<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;show&nbsp;cov.&nbsp;matrix</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edxx,<span class=quotes>'String'</span>,sigma(1,1));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edxy,<span class=quotes>'String'</span>,sigma(1,2));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edyx,<span class=quotes>'String'</span>,sigma(2,1));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.edyy,<span class=quotes>'String'</span>,sigma(2,2));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=jump>break</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;~strcmpi(get(...</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'alt'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;===&nbsp;Right&nbsp;mouse&nbsp;button&nbsp;&nbsp;===</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;erase&nbsp;point</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(<span class=graph>get</span>(hobject,<span class=quotes>'tag'</span>),<span class=quotes>'point'</span>)==1,<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;object&nbsp;is&nbsp;point</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pixelpos=[<span class=graph>get</span>(hobject,<span class=quotes>'XData'</span>);<span class=graph>get</span>(hobject,<span class=quotes>'YData'</span>)];<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=sum(sets.K);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:K,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pos=sets.X(:,i);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;pixelpos==pos,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;update&nbsp;data&nbsp;sets</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.K(sets.I(i))=sets.K(sets.I(i))-1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.I=[sets.I(:,1:i-1),sets.I(:,i+1:K)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.X=[sets.X(:,1:i-1),sets.X(:,i+1:K)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.axes1,<span class=quotes>'UserData'</span>,sets);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;erase&nbsp;point</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hobject,<span class=quotes>'EraseMode'</span>,<span class=quotes>'normal'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete(hobject);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;up&nbsp;saved&nbsp;flag</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.saved=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=jump>break</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;pixelpos</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;for</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>elseif</span>&nbsp;strcmpi(<span class=graph>get</span>(hobject,<span class=quotes>'tag'</span>),<span class=quotes>'ellipse'</span>)==1,<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;object&nbsp;is&nbsp;ellipse</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pixelpos=<span class=graph>get</span>(hobject,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=sum(sets.K);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;i=1:K,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pos=sets.MI(:,i);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;pixelpos==pos,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;update&nbsp;data&nbsp;sets</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.K(sets.I(i))=sets.K(sets.I(i))-1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.I=[sets.I(:,1:i-1),sets.I(:,i+1:K)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.MI=[sets.MI(:,1:i-1),sets.MI(:,i+1:K)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.SIGMA=[sets.SIGMA(:,1:(i-1)*2),sets.SIGMA(:,i*2+1:K*2)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currpoint=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currhandle=0;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.axes1,<span class=quotes>'UserData'</span>,sets);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;erase&nbsp;point</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hobject,<span class=quotes>'EraseMode'</span>,<span class=quotes>'normal'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete(hobject);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;up&nbsp;saved&nbsp;flag</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.saved=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=jump>break</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;pixelpos</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;for&nbsp;i=1:K,</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;strcmpi(get(hpixel,...</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;switch&nbsp;lower(get...</span><br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'load'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Invokes&nbsp;stadard&nbsp;load&nbsp;file&nbsp;window&nbsp;====================================</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;loads&nbsp;data&nbsp;from&nbsp;file&nbsp;and&nbsp;then&nbsp;puts&nbsp;them&nbsp;on&nbsp;the&nbsp;desktop.</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;data&nbsp;sets&nbsp;structure</span><br>
&nbsp;&nbsp;&nbsp;sets=<span class=graph>get</span>(h.axes1,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;loadit=1;<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;h.saved==0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;answer=questdlg(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Data&nbsp;set&nbsp;was&nbsp;changed.&nbsp;Do&nbsp;you&nbsp;want&nbsp;to&nbsp;continue?'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Warning'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Continue'</span>,<span class=quotes>'Cancel'</span>,<span class=quotes>'Cancel'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;answer==0&nbsp;|&nbsp;strcmpi(answer,<span class=quotes>'Cancel'</span>),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loadit=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;loadit==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[name,path]=uigetfile(<span class=quotes>'*.mat'</span>,<span class=quotes>'Load&nbsp;data&nbsp;set'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;name&nbsp;~=&nbsp;0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pathname=strcat(path,name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(sets.id,&nbsp;ID_FINITE),&nbsp;a&nbsp;=&nbsp;check2ddata(pathname);&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(sets.id,&nbsp;ID_NORMAL),&nbsp;a&nbsp;=&nbsp;check2dgauss(pathname);&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<span class=comment>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;checkdat(pathname,sets.id,sets.N,0)==1,</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;a,<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;store&nbsp;path</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.name=name;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.path=path;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.pathname=pathname;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.btsave,<span class=quotes>'UserData'</span>,file);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oldID=sets.id;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;load&nbsp;data&nbsp;set&nbsp;and&nbsp;store&nbsp;it</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets=load(file.pathname);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.id&nbsp;=&nbsp;oldID;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.I&nbsp;=&nbsp;sets.y;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.N=2;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;ii=1:max(sets.I),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.K(ii)=length(find(sets.I==ii));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;strcmpi(sets.id,&nbsp;ID_NORMAL),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.MI&nbsp;=&nbsp;sets.Mean;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.SIGMA=[];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;ii=1:size(sets.Mean,2),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets.SIGMA=[sets.SIGMA,&nbsp;sets.Cov(:,:,ii)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.axes1,<span class=quotes>'UserData'</span>,sets);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;everything&nbsp;possible...</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currpoint=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.currhandle=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.saved=1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;and&nbsp;put&nbsp;it&nbsp;on&nbsp;the&nbsp;desktop</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;createdata(<span class=quotes>'redraw'</span>,hfigure);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;print&nbsp;title</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;titletext=<span class=io>sprintf</span>(<span class=quotes>'File:&nbsp;%s'</span>,file.name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.title,<span class=quotes>'String'</span>,titletext);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;errordlg(<span class=quotes>'This&nbsp;file&nbsp;does&nbsp;not&nbsp;contain&nbsp;required&nbsp;data.'</span>,<span class=quotes>'Bad&nbsp;file'</span>,<span class=quotes>'modal'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;name&nbsp;~=&nbsp;0,</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;loadit==1,</span><br>
<br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'save'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Invokes&nbsp;standard&nbsp;save&nbsp;file&nbsp;window&nbsp;====================================</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;and&nbsp;prepares&nbsp;data&nbsp;for&nbsp;saving.</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;handlers</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;data&nbsp;set</span><br>
&nbsp;&nbsp;&nbsp;sets=<span class=graph>get</span>(h.axes1,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;is&nbsp;there&nbsp;something&nbsp;to&nbsp;save&nbsp;?</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;sum(sets.K)~=0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;current&nbsp;file&nbsp;name</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file=<span class=graph>get</span>(h.btsave,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;invoke&nbsp;save&nbsp;window</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[name,path]=uiputfile(file.pathname,<span class=quotes>'Save&nbsp;file'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;Have&nbsp;user&nbsp;pushed&nbsp;down&nbsp;close&nbsp;button&nbsp;or&nbsp;save&nbsp;button&nbsp;?</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;name&nbsp;~=&nbsp;0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;store&nbsp;file&nbsp;name</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.name=name;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.path=path;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file.pathname=strcat(path,name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.btsave,<span class=quotes>'UserData'</span>,file);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;print&nbsp;title</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;titletext=<span class=io>sprintf</span>(<span class=quotes>'File:&nbsp;%s'</span>,file.name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(h.title,<span class=quotes>'String'</span>,titletext);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;remove&nbsp;classes&nbsp;which&nbsp;have&nbsp;zero&nbsp;length</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ssets=sets;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KL=size(sets.K,2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NK=sum(sets.K);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;following&nbsp;vars&nbsp;are&nbsp;to&nbsp;be&nbsp;saved</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id=sets.id;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I=sets.I;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=sets.K;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;N=sets.N;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;remove&nbsp;zero's&nbsp;clases</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i=1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>while</span>&nbsp;i&nbsp;&lt;=&nbsp;KL,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;K(i)==0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;j=1:NK,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;I(j)&nbsp;&gt;&nbsp;i,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I(j)=I(j)-1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;K=[K(1:i-1),K(i+1:KL)];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KL=KL-1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i=i+1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;save&nbsp;data&nbsp;set&nbsp;to&nbsp;the&nbsp;file</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>switch</span>&nbsp;h.settype<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'finite'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X=sets.X;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y=I;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;save(file.pathname,<span class=quotes>'X'</span>,<span class=quotes>'y'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'gauss'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mean=sets.MI;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y=I;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;jj=1:size(Mean,2),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cov(:,:,jj)=sets.SIGMA(:,(jj-1)*2+1:jj*2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;save(file.pathname,<span class=quotes>'Mean'</span>,<span class=quotes>'Cov'</span>,<span class=quotes>'y'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;set&nbsp;up&nbsp;saved&nbsp;flag</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h.saved=1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=graph>set</span>(hfigure,<span class=quotes>'UserData'</span>,h);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;name&nbsp;~=&nbsp;0,</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;sum(sets.K)~=0,</span><br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'ok'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;OK&nbsp;button&nbsp;handler&nbsp;===================================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;nadlers</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;is&nbsp;dialog&nbsp;to&nbsp;be&nbsp;closed&nbsp;?</span><br>
&nbsp;&nbsp;&nbsp;closeit=1;<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;h.saved==0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;data&nbsp;have&nbsp;not&nbsp;saved.</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;answer=questdlg(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Data&nbsp;set&nbsp;was&nbsp;changed.&nbsp;Do&nbsp;you&nbsp;want&nbsp;to&nbsp;save&nbsp;data?'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Warning'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Save'</span>,<span class=quotes>'Don`t&nbsp;save'</span>,<span class=quotes>'Cancel'</span>,<span class=quotes>'Cancel'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;decide&nbsp;along&nbsp;to&nbsp;the&nbsp;answer</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;answer&nbsp;~=&nbsp;0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>switch</span>&nbsp;lower(answer)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'save'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;createdata(<span class=quotes>'save'</span>,hfigure);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closeit=h.saved;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'cancel'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closeit=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'don`t&nbsp;save'</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;close(hfigure,hfigure);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=jump>return</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closeit=1;</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closeit=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;answer~=0,...else</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>&nbsp;<span class=comment>%&nbsp;if&nbsp;h.saved==0,</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;close&nbsp;dialog</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;closeit==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;if&nbsp;some&nbsp;data&nbsp;was&nbsp;created&nbsp;invoke&nbsp;function&nbsp;given&nbsp;in&nbsp;arguments</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sets=<span class=graph>get</span>(h.axes1,<span class=quotes>'UserData'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command=<span class=graph>get</span>(h.btok,<span class=quotes>'UserData'</span>);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file=<span class=graph>get</span>(h.btsave,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;sum(sets.K)~=0&nbsp;&&nbsp;size(command,2)&nbsp;&gt;&nbsp;2,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=eval>feval</span>(command{3},command{4:size(command,2)},file.path,file.name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;close(hfigure);<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=label>case</span>&nbsp;<span class=quotes>'close'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Close&nbsp;button&nbsp;handler&nbsp;===================================================</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;get&nbsp;nadlers</span><br>
&nbsp;&nbsp;&nbsp;hfigure=<span class=stack>varargin</span>{1};<br>
&nbsp;&nbsp;&nbsp;h=<span class=graph>get</span>(hfigure,<span class=quotes>'UserData'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;closeit=1;<br>
<br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;data&nbsp;set&nbsp;changed&nbsp;?</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;h.saved==0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;data&nbsp;have&nbsp;not&nbsp;saved.</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;answer=questdlg(...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Data&nbsp;set&nbsp;was&nbsp;changed.&nbsp;Do&nbsp;you&nbsp;want&nbsp;to&nbsp;close?'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Warning'</span>,...<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=quotes>'Close'</span>,<span class=quotes>'Cancel'</span>,<span class=quotes>'Cancel'</span>);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;decide&nbsp;along&nbsp;to&nbsp;the&nbsp;answer</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;answer&nbsp;==&nbsp;0&nbsp;|&nbsp;strcmpi(answer,<span class=quotes>'Cancel'</span>)==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closeit=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>if</span>&nbsp;closeit==1,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;close(hfigure);<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span><br>
<br>
<span class=label>case</span>&nbsp;<span class=quotes>'info'</span><br>
&nbsp;&nbsp;&nbsp;<span class=comment>%&nbsp;==&nbsp;Call&nbsp;standard&nbsp;Matlab&nbsp;info&nbsp;box&nbsp;=========================================</span><br>
&nbsp;&nbsp;&nbsp;helpwin(mfilename);<br>
<br>
<span class=keyword>end</span><br>
<br>
<span class=jump>return</span>;<br>
<br>
<span class=comment>%========================================&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
<span class=defun_kw>function</span>&nbsp;<span class=defun_out>[rect]</span>=<span class=defun_name>getaxis</span>(<span class=defun_in>handle</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<span class=comment>%&nbsp;function&nbsp;[rect]=getaxis(handle)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
<span class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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
rect=[<span class=graph>get</span>(handle,<span class=quotes>'XLim'</span>),<span class=graph>get</span>(handle,<span class=quotes>'YLim'</span>),<span class=graph>get</span>(handle,<span class=quotes>'ZLim'</span>)];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<span class=jump>return</span>;&nbsp;<br>
<br>
<br>
<span class=defun_kw>function</span>&nbsp;<span class=defun_out>[]</span>=<span class=defun_name>setaxis</span>(<span class=defun_in>handle,rect</span>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<span class=comment>%&nbsp;function&nbsp;[]=setaxis(handle,rect)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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